<?php

namespace App\Http\Transformers\User;

use League\Fractal\TransformerAbstract;
use App\Models\UserLoginLog;

class UserLoginLogPageTransformer extends TransformerAbstract
{
    public function transform(UserLoginLog $userLoginLog)
    {
        $data = $userLoginLog->toArray();

        //数据处理
        data_set($data, 'mobile', data_get($data, 'user.mobile'));
        data_set($data, 'realname', data_get($data, 'user.realname'));
        data_set($data, 'username', data_get($data, 'user.username'));

        unset($data['user']);

        return $data;
    }
}
